<%-- 
    Document   : addBook
    Created on : 30-Mar-2011, 18:18:53
    Author     : Thomas
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<jsp:useBean id="addBookBean" class="beans_pkg.addBookBean" scope="page"/>
<jsp:setProperty name="addBookBean" property="*"/>

<%@ include file="header.jsp" %>

<!-- Content -->

<div id="container">
	<div id="content" role="main">

                Category: <%= addBookBean.getCategory() %><br />
                ISBN: <%= addBookBean.getISBN() %><br />
                Title: <%= addBookBean.getTitle() %><br />
                Description: <%= addBookBean.getDescription() %><br />
                Price: <%= addBookBean.getPrice() %><br />

    <%
        bookDatabase_pkg.bookDatabaseDriver driver = new bookDatabase_pkg.bookDatabaseDriver();

        String category = addBookBean.getCategory();
        String ISBN = addBookBean.getISBN();
        String Title = addBookBean.getTitle();
        String Description = addBookBean.getDescription();
        String Price = addBookBean.getPrice();

        int result = driver.databaseConnect(category);
        if(result == 0){
            out.println("Database: " + category + " connected<br />");
        }
        else{
            out.println("ERROR: Database " + category + " cannot be found!<br />");
        }

        String result2 = driver.addBook(ISBN, Title, Description, Price);
        out.println("Database: " + result2 + "<br />");
    %>

            <p><a href="adminPage.jsp">Return</a></p>
        </div><!-- #content -->
</div><!-- #container -->

<%@ include file="sidebar.jsp" %>

<!-- /Content -->

<%@ include file="footer.jsp" %>
